package service;



import dao.UserDao;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Repository
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;


    /**
     * This is the method to be used to create
     * a record in the User table.
     *
     * @param username
     * @param email
     * @param password_hash
     * @param about_me
     * @param last_seen
     */
    @Override
    public void create(String username, String email, String password_hash, String about_me, LocalDateTime last_seen) {
        userDao.create(username,email,password_hash,about_me,last_seen);
    }

    /**
     * This is the method to be used to list down
     * a record from the User table corresponding
     * to a passed user id.
     *
     * @param id
     */
    @Override
    public User getUser(Integer id) {
        return userDao.getUser(id);
    }

    /**
     * This is the method to be used to list down
     * all the records from the User table.
     */
    @Override
    public List<User> listUsers() {
        return userDao.listUsers();
    }

    /**
     * This is the method to be used to delete
     * a record from the User table corresponding
     * to a passed user id.
     *
     * @param id
     */
    @Override
    public void delete(Integer id) {
        userDao.delete(id);
    }

    /**
     * This is the method to be used to update
     * a record into the User table.
     *
     * @param id
     * @param about_me
     */
    @Override
    public void update(Integer id, String about_me) {
        userDao.update(id,about_me);
    }

    /**
     * This is the method to be used to update
     * a record into the User table.
     *
     * @param id
     * @param age
     */

}
